﻿namespace Sidvall.LogManager.Data.Entity.Entities
{
    public partial class LogScope : global::Sidvall.Data.DataRowBase, global::Sidvall.LogManager.Data.ILogScope
    {
        #region Public Members

        #region LogScopeId

        private long _LogScopeId;
        public long LogScopeId
        { 
            get
            {
                return _LogScopeId;
            }
            set
            {
                _LogScopeId = value;
            }
        }

        #endregion
        #region Name

        private string _Name;
        public string Name
        { 
            get
            {
                return _Name;
            }
            set
            {
                _Name = value;
            }
        }

        #endregion
        
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public virtual System.Collections.Generic.ICollection<Sidvall.LogManager.Data.Entity.Entities.LogScopeItem> LogScopeItem { get; set; }
        
        #region DataRowContextStorageKey

        protected override string DataRowContextStorageKey
        {
            get
            {
                return global::Sidvall.LogManager.Data.Entity.SystemContext.Current.EntityFacade.LogScopeManager.GetKey(this);
            }
        }

        #endregion
        #region DataRowStateIsDirty

        protected override bool DataRowStateIsDirty
        {
            get
            {
                return global::Sidvall.LogManager.Data.Entity.SystemContext.Current.EntityFacade.LogScopeManager.DataRowStateIsDirty(this);
            }
        }

        #endregion

        #region ILogScope Members

        System.Nullable<long> global::Sidvall.LogManager.Data.ILogScope.LogScopeId
        {
            get
            {
                return this._LogScopeId;
            }
            set
            {
                if (value != null)
                    this.LogScopeId = value.Value;
            }
        }
        string global::Sidvall.LogManager.Data.ILogScope.Name
        {
            get
            {
                return this._Name;
            }
            set
            {
                this.Name = value;
            }
        }
        System.Nullable<System.Int32> global::Sidvall.LogManager.Data.ILogScope.ServerConnectionId
        {
            get
            {
                return null;
            }
            set
            {
            }
        }
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
        System.Collections.Generic.IEnumerable<ILogScopeItem> global::Sidvall.LogManager.Data.ILogScope.LogScopeItems
        {
            get
            {
                return this.LogScopeItem;
            }
        }
        void global::Sidvall.LogManager.Data.ILogScope.SetLogScopeItems(Sidvall.Data.IDataRowProvider<global::Sidvall.LogManager.Data.ILogScopeItem> items)
        {
            this.LogScopeItem = items as LogScopeItemCollection;
        }

        #endregion

        #endregion
        #region Constructors

        public LogScope() : this(false, null, null)
        {
        }
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
        public LogScope(bool initializeChildren, Sidvall.Data.IDataRowContextProvider context, Sidvall.Data.DataRowState? dataRowState)
        {
            if ((context != null) || (dataRowState != null))
                SetDataRowContext(context, dataRowState);
            if (initializeChildren)
            {
                this.LogScopeItem = new System.Collections.Generic.List<LogScopeItem>();
            }
        }

        #endregion
    }
}